TMMPlot This Delphi-Component allows the user to easily display a HPGL/2-plot on a form, paintbox or printer canvas. Free definable pencolors. The functionality is comparable to the mediaplayer. The component has no own canvas but needs a canvas to display the graphics. Pencolors and penstyles are set automatically, other canvasoptions have to be preset. Advanced Version includes zoom & pan and zoom-to-printer. Professional Version includes print-2-scale and send-to-plotter. LIST OF FILES. File Description TMMPlot.TXT Software Documentation (this file). TMMPlot.REG Registration form. TMMPlot.DCU Component object code. TMMPlot.DCR Component resource file. MMPLOT.DLL DLL required from TMMPLOT and MMPlot.EXE MMPlot.ini You can determine in which page of the gallery TMMPlot is to be installed. (It is recommended to copy MMPlot.DLL and MMPlot.ini into your WINDOWS or SYSTEM directory) DEMO.DPR Demo project file DEMO.RES Demo project resource file MAIN.PAS Demo unit MAIN.DFM Demo form SAMPLE.PLT Demo-Plotfile. eventually: MMPlot.EXE Viewer based on TMMPLOT MMPlot.TXT Software Documentation (Viewer). PROPERTIES -Published- Active: boolean Active=true opens a file and projection is enabled. Display: tpaintbox The projector screen can be selected. If no paintbox is available/selected, the parent form will be the display. DitherOfs:integer Correction offset to fix dithering density PenWidthfactor:integer Correction factor to fix penwidths Default = 4 --> PW0.25 * 4 = 1 pixel GraphDir, GraphName: string Plotdirectory and HPGL-Sourcefile IsOpen:boolean Plotfile was opened IsZoomed:boolean Zoom active IsPanned:boolean Pan active MapMode: TMapMode Show Plot in isotropic/anisotropic mode Name: TComponentname Options: TGraphOptions Various graphic options can be set as there are: [**] goPrint : Output to Printer [**] goOrigScale : Print in original scale [**] goGrid : Display pageframes on screen. [**] goPageNums : Print Pagenumbers on the different sheets. [**] goBlackprint : Print using black pen for all colors. Startpage, Endpage, PrintCopies: word [**] See TReport.... Painttiming: TPaintTiming This depicts when the OnPaint-eventhandling will be executed in relation to Display.OnPaint. Possible values are: ptBefore : Before Display.OnPaint ptReplace: Instead of Display.OnPaint ptAfter : After Display.OnPaint Pen1...Pen8: tcolor colors for plotter-pens no 1 to 8 Pencolor[Index:Integer]:tColor up to 255 pencolors can be set BackGnd:Tcolor Backgroundcolor used for dithered fill Port: TMMComm You can assign a communication port of the TMMComm or derived classes. If no Port is assigned, TMMPlot will create its own, using default parameter,if necessary. Title:string Title displayed in printmanager -Public- Version : string RevisionCode ( 16.02e = 16bit-revision 2-english ) Error : string Display Errortext and clear it (if any) Filename: string HPGL-file with complete path Blackprint : boolean All printer output will use black pen & brush DirecttoPort: boolean if TRUE : Send directly to local port specified by portname (WriteComm), if FALSE: File will be copied to destination file or port. Destination : string filename to copy the file to, may also be a port name (not under WinNT) PortName : string For Example: "COM3:" BaudRate : TBaudRate = (br110, br300, br600, br1200, br2400, br4800, br9600, br14400, br19200, br38400, br56000, br128000, br256000); ParityBits : TParityBits = (pbNone, pbOdd, pbEven, pbMark, pbSpace); DataBits : TDataBits = (dbFour, dbFive, dbSix, dbSeven, dbEight); StopBits : TStopBits = (sbOne, sbOnePointFive, sbTwo); FlowControl : TFlowControl = (fcNone, fcRTSCTS, fcXONXOFF); METHODS constructor Create(AOwner: TComponent); destructor Free; procedure Close; Deactivate, Close Plotfile procedure ZoomAll; Reset Zoom, Refresh procedure SetZoom( r : trect ); Zoom-In procedure Pan ( r : trect ); Pan function SaveFileAs(newname:tfilename):boolean; Save Plotdata in binary file Returns TRUE if ERROR !!! procedure Hardcopy; Hardcopy in actual mode function Send:boolean; Send or copy to plotter/printer port or file procedure SetDefPal_255; Set System default palette colors procedure SetACADPal_9; Set Pen 1..9 Autocad colors procedure SetStdPal_8; function Size( Var mmx,mmy : longint; Var PageCount : word ):boolean; { true = ERROR } Returns the Dimensions of the Plot and the amount of printer pages it would take to print the whole thing in original scale. function Info( p : pPlotInfo ):boolean; Provides more details concerning the plot in the following structure: plotInfo = ^tPlotInfo; { pointer on struct } type tPlotInfo = record mmx, mmy, { Dim [mm] } plxmax, { Max x [plotunit] } plymax, { Max y [plotunit] } plxmin, { Min x [plotunit] } plymin : longint; { Min y [plotunit] } penbuf : array[0..255] of byte; { used pens (penbuf[0]=highest penNr) } { penbuff[i] > 0 = pen i used } pages : word; { required page# on actual printer } end; procedure GetPortsAvail( SerialOnly: boolean; List: TStrings ); Fills a string list with the names of the currently available ports procedure orientate(r:real); Rotate: r=0°/90°/180°/270° EVENTS OnActivate OnDeactivate OnFileOpen File will be opened on first activation or on a call to .Size or .Info method. OnPaint Paint event, hooked into display's paintevent See property painttiming. Installing TMMPlot To install this VCL, copy both MMPlot.DCU and MMPlot.DCR to the directory where you have your other shareware controls. Then, from Delphi's main menu, select Options|Install Components. In the dialog, click on the Add... button, then Browse... and change to the drive/directory where you stored the above two files. Select MMPlot.DCU and click OK, then OK again. Copy MMPLOT.DLL into Your outputdirectory for your EXE or DLL or to Your Windows or System directory (recommended for Designers). The component needs MMPLOT.DLL to interpret HPGL-files. The DLL is dynamically loaded and may not be needed if the plot is "precompiled". See section below for more information. You can copy MMPlot.INI into your Windows directory to Determine into which gallery page the component(s) should be installed. Using TMMPlot To use this control, simply place it on your form, and edit the Graphname, Options, Pens and Display properties. If you have the pro version and place a TMMComm or derived component on the Form, you can select is as the port property for a TMMPlot. You can use TMMPLOT without MMPLOT.DLL in certain circumstances. The DLL is loaded dynamically when the first HPGLfile is opened. Raw graphic data is saved in a temporary binary file (Property FFilename). You can display this kind of file (*.TMP;*.DAT) without the use of the DLL. Loading is much faster and the DLL is not required. The demo shows how to do this. Action: Save as xxx.dat..., then open this file... Print-2-Scale is yet limited to original scale 1:1. Procedural interface Function PlotSizeFromFile( Filename : tfilename; plotfile Var mmx, plotwidth [mm] mmy : longint; plotheight [mm] Var PageCount: word # printer pages (using print-2-scale) ):boolean; true if ERROR !!! Function PlotInfoFromFile( FName : tfilename; p : pPlotInfo):boolean; true if ERROR !!! Function OutPlot( Filename : tfilename; Canvas : tCanvas; { Outputcanvas } CParent : tObject; { Form,Printer,Picturebox...} MapMode : Longint; { 0 = isotropic, 1 = Anisotropic, 2 = Himetric } StartPage, { [**] print-to-scale only } EndPage : integer; { [**] print-to-scale only } Blackprint: boolean { print all colours with black pen } ):boolean; Function GetDLLVersion:String ( 16.02e = 16bit - revision 2 - english ) Further options [**] Zoom & Pan is not included in the lite version but in Advanced version. A professional version is released including all features plus print-to-scale and Send-to-Port. The component is designed to display on paintboxes or the form but any canvas is possible as output media. Please feel free to contact me if You have any special needs. All Features have been tested under Win3.11/95/NT. A 32bit Version of the DLL is available but the 32bit Component will be available when delphi 2.0 is released. A communications component TMMComm is shipped with the pro version plus Demo and documented source code. MMPlot hpgl/2-viewer is available as shareware. Also 32bit Version. The Component/DLL is available in english and german, please contact if you prefer another language. Benefits of Registration Most HPGL/2 language is implemented. Registered users are supported if they have any problems with a special plotformat. The unregistered component includes from time to time a shareware message into the output. Registered users have the right to incorporate and distribute the component as part of their application(s). Registered Users (Pro) receive the source code of the Communications Component TMMComm. Registering TMMPlot To register TMMPlot lite, send $85 (+$8 S&H) to: To register TMMPlot advanced, send $170 (+$8 S&H) to: To register TMMPlot professional, send $255 (+$8 S&H) to: MAMAVISION Software Consult Wollmatingerstr. 70B 78467 Konstanz *** Germany *** or register in Compuserve: Lite - GO SWREG 9785 Advanced - GO SWREG 9932 Pro - GO SWREG 10070 Please report all bugs, suggestions, and problems to: Markus Mayer Compuserve ID: 100335,430 Internet adress: 100335.430@CompuServe.com You can save the $8 shipping fee by specifying a Compuserve account to have your control sent to instead of by mail. Although TMMPlot functions flawlessly on our computer systems the authors assume no responsibility for the use or misuse of the component. This package may be copied and distributed freely providing that it is not modified, no fee is charged, and it is not made part of a package for which a charge is made. If you upload this package to other bulletin boards, we'd appreciate it if you would try to keep the upload current. TMMPlot is (c)1996 copyright by MAMAVISION Software Consult